<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户注册</title>
<style type="text/css">
<!--
td {  font-size: 9pt}
-->
</style>
<script type="text/javascript">

function check_username(field)
{
	if (field.value.length < 3 || field.value.length > 32)
	{
		alert("User name must be 6 ~ 32 characters!");
		return false
	}
	return true
}

function check_password(field1, field2)
{
	if(field1.value != field2.value)
	{
		alert("Password mismatch!");
		return false
	}
	if(field1.value.length < 6)
	{
		alert("Password too short!");
		return false
	}
	return true
}

function check_email(field)
{
	with (field)
	{
		apos=value.indexOf("@")
		dotpos=value.lastIndexOf(".")
		if (apos<1||dotpos-apos<2) 
		{
			alert("Email address is not valid!");
			return false
		}
		else
		{
			return true
		}
	}
}

function validate_form(thisform)
{
	with (thisform)
	{
		if (check_username(username) == false)
		{
			username.focus();
			return false
		}
		if (check_password(password, password2) == false)
		{
			password.focus();
			return false
		}
		if (check_email(email) == false)
		{
			email.focus();
			return false
		}
	}
}
</script>
</head>
</head>

<?php
session_start();
$refid = $_SESSION['refid'];
?>

<body bgcolor="#ffffff" topmargin=0>
<center>
  <p>&nbsp;</p>
  <table border=0 cellpadding=3 cellspacing=5 width="589">
    <form method="POST" name="regform" onsubmit="return validate_form(this);" action="doregister.php">
       <tr> 
        <td colspan=3 bgcolor="#ccddFF">帐户信息 </td>
      </tr>
      <tr> 
        <td nowrap bgcolor="#FFFFFF" width="78"> 用户名* </td>
        <td nowrap bgcolor="#FFFFFF" width="179"> 
          <input type="text" name="username" value="" size="28" maxlength="32">
        </td>
        <td bgcolor="#eeFFee" width="298"> 最少3个字符。只能使用字母、数字、"-"、"_"。此用户名也是VPN拨号的用户名</td>
      </tr>
      <tr> 
        <td nowrap bgcolor="#FFFFFF" width="78"> 密码* </td>
        <td bgcolor="#FFFFFF" width="179"> 
          <input type="password"  name="password" size="28" maxlength="32">
        </td>
        <td rowspan=2 bgcolor="#eeFFee" width="298"> 至少包含六个字符</td>
      </tr>
      <tr> 
        <td nowrap bgcolor="#FFFFFF" width="78"> 确认密码* </td>
        <td bgcolor="#FFFFFF" width="179"> 
          <input type="password"  name="password2" size="28" maxlength="32">
        </td>
      </tr>
      <tr> 
        <td nowrap bgcolor="#FFFFFF" width="78"> Email* </td>
        <td nowrap bgcolor="#FFFFFF" width="179"> 
          <input type="text" name="email" value="" size="28" maxlength="64">
        </td>
        <td bgcolor="#eeFFee" width="298"> 请输入Email地址，用来接收帐户激活邮件</td>
      </tr>
      <tr> 
        <td nowrap bgcolor="#FFFFFF" width="78"> 邀请人 </td>
        <td nowrap bgcolor="#FFFFFF" width="179"> 
<?php
echo"          <input type=\"text\" name=\"refid\" value=\"$refid\" size=\"28\" maxlength=\"32\">"
?>
        </td>
        <td bgcolor="#eeFFee" width="298"> 请输入邀请人ID。注册成功后，邀请人和被邀请人都将获得5元奖励</td>
      </tr>
      <tr> 
        <td height="75" colspan="4" align="right"> 
          <p> 
          <hr size="1" color="#8CA5B5">
          <input type="submit"  name="submit" value=" 注册 " >
        </td>
      </tr>
    </form>
    <tr> 
      <td colspan=4> <br>
        <p><br>
        <p><br>
        <p><br>
        <p><br>
        <p> &nbsp; 2015 &copy; <a href="http://www.thewestlake.net/">西湖网络</a>
      </td>
    </tr>
  </table>
</center>
</body></html>

